package cc.ucanuup.config.base;

import javax.servlet.Filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class filterConfig {
	/**
	 * 配置过滤器
	 * @return
	 */
	@Bean
	public FilterRegistrationBean someFilterRegistration() {
		FilterRegistrationBean registration = new FilterRegistrationBean();
		registration.setFilter(configFilter());
		registration.addUrlPatterns("/*");
		registration.setName("bzConfigFilter");
		return registration;
	}

	/**
	 * 创建一个bean
	 * @return
	 */
	@Bean(name = "configFilter")
	public Filter configFilter() {
		return new ConfigFilter();
	}
}